{% extends 'drops/drops_base.html' %}
{% import 'bootstrap/wtf.html' as wtf %}
{% block head %}
   {{ super() }}
   <link rel="stylesheet" href="{{ url_for('drops.static', filename='plugins/editormd/css/editormd.preview.css') }}">
   <link rel="stylesheet" href="{{ url_for('drops.static', filename='plugins/editormd/css/editormd.css') }}" />
{% endblock %}
{% block content %}
    <div class="container" w90>
        <div class="contentform">
            <form action="" method="post" class="form-inline" role="form">

                <div style="display:none;">
                    {{ form.csrf_token(type="hidden") }}
                </div>
                <div class="form-group required">
                    <span style="font-size:16px;font-weight:bold;">标题名：</span>{{ form.title.label(class="sr-only") }}{{ form.title(class="form-control" ) }}
                </div>
                <div class="form-group required">
                    <span style="font-size:16px;font-weight:bold;">drop名：</span>{{ form.dropname.label(class="sr-only") }}{{ form.dropname(class="form-control" ) }}
                </div>
                <div class="form-group required">
                    <span style="font-size:16px;font-weight:bold;">tag：</span>{{ form.tag.label(class="sr-only") }}{{ form.tag(class="form-control") }}
                </div>
                <div class=form-group>
                    <label class="sr-only" for="button">button</label>
                    <button type="submit" class="btn btn-success btn-large btn-block" type="button">确认OK，立刻发布</button>
                </div>

                <hr>{{ wtf.form_field(form.category) }}
                <hr>

                <div id="editormd">
                    <textarea name="content" style="display:none;">{{ form.content.data}}</textarea>
                </div>

            </form>
        </div>
    </div>
    <div class="container">
        {% for message in get_flashed_messages() %}
        <div class="alert alert-warning">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            {{ message }}
        </div>
        {% endfor %}

    </div>

    <script src="{{ url_for('drops.static', filename='jquery.min.js') }}"></script>
    <script src="{{ url_for('drops.static', filename='jquery.cookie.js') }}"></script>
    <script src="{{ url_for('drops.static', filename='plugins/editormd/editormd.js') }}"></script>
    <script type="text/javascript">
        $(function() {
            testEditor = editormd("editormd", {
                width: "100%",
                height: 740,
                theme : "dark",
                previewTheme : "default",
                editorTheme : "neat",
                //markdown : md,
                codeFold : true,
                //syncScrolling : false,
                saveHTMLToTextarea : true,    // 保存 HTML 到 Textarea
                searchReplace : true,
                emoji : true,
                taskList : true,
                tocm : true,         // Using [TOCM]
                tex : true,                   // 开启科学公式TeX语言支持，默认关闭
                flowChart : true,             // 开启流程图支持，默认关闭
                sequenceDiagram : true,       // 开启时序/序列图支持，默认关闭,
                path: "{{ url_for('drops.static', filename='plugins/editormd/lib/') }}",
                imageUpload: true,
                imageFormats: ["jpg", "jpeg", "gif", "png", "bmp"],
                imageUploadURL: "{{url_for('drops.upload_img')}}",
            });
        });

    </script>
{% endblock %}
